Skip to content

[Data Validation] Add table configuration - #4188

Merged
aasthabharill merged 21 commits into
mainfrom
dv-table-config
Sep 13, 2026
Merged

[Data Validation] Add table configuration#4188
aasthabharill merged 21 commits into
mainfrom
dv-table-config

Conversation

@aasthabharill

@aasthabharill aasthabharill commented Aug 28, 2026

Copy link
Copy Markdown
Member

b/514940857

Added two new pipeline parameters:

  1. tables: comma-separated list of source tables for small configurations
  2. tableConfigurationFilePath: GCS File path containing list of source tables in a text file for large workloads

Design Decisions

Why two different template params?

tables will be extremely inconvenient to configure in case user needs to configure large number of tables

tableConfigurationFilePath is JSON file

Extensible for future additions
Example:

{
  "tableNames": ["table1", "table2"],
  "tableConfigurations": {
    "table2": { "columnsToValidate": [...] }
  }
}

Table names are to be specified as per their source names

More intuitive for users as they are more familiar with their source schemas. In case of Spanner table renames, the user specifies an overrides file/session file - which will be used to map their configured tables to their corresponding Spanner names

Fail fast if both template params are provided

There should be only one source of truth for the configured tables and since the purpose for both template params is the same, it doesn't make sense to pass both.

No mechanism to fail fast if configured tables do not exist in source

Since our source is the GCS Avro directory, if a source table exists but has zero rows, it will not have any entry in GCS.
Therefore, GCS records for a table not existing could mean either of two things:

  1. The table doesn't exist on source and was misconfigured by the user
  2. The table does exist on source but has 0 rows.
    Since there's no way to differentiate between these two cases, we cannot introduce a fail-fast loop to identify a misconfigured table list.

Testing

  • Added comprehensive unit tests for all changes
  • Added an integration test for the scenario where tables mentions a subset of tables which were renamed in spanner (so tests table config in combination with overrides)

@aasthabharill aasthabharill added the addition New feature or request label Aug 28, 2026
@aasthabharill
aasthabharill marked this pull request as ready for review September 2, 2026 11:04
@aasthabharill
aasthabharill requested a review from a team as a code owner September 2, 2026 11:04
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces table-level filtering for the GCS-to-Spanner Data Validation pipeline. By allowing users to specify a subset of tables via a comma-separated list or a GCS file path, the pipeline can now perform targeted validation, significantly improving efficiency when working with large schemas.

Highlights

  • Table Filtering Configuration: Added new template parameters 'tables' and 'tableListFilePath' to allow users to specify a subset of tables for validation.
  • Pipeline Integration: Implemented a new 'TableSelectionConfig' class and integrated it into the source and Spanner reader transforms to filter data processing.
  • Testing and Documentation: Updated documentation and added comprehensive unit and integration tests to ensure the new filtering logic functions correctly.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces table-based filtering to the GCS to Spanner Data Validation pipeline, allowing users to specify a subset of tables to validate via a comma-separated list or a GCS file path. Feedback on the changes focuses on improving robustness and code quality, including adding defensive null checks to prevent potential NullPointerExceptions in SourceReaderTransform, TableSelectionConfig, and CreateSpannerReadOpsFn. Additionally, it is recommended to use StandardCharsets.UTF_8 instead of string literals, and to remove a redundant Thread.sleep call in the integration tests as the Dataflow runner's startup time is already sufficient to satisfy the staleness window.

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.69%. Comparing base (1576166) to head (c004f0f).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...e/cloud/teleport/v2/config/TableConfiguration.java 87.23% 0 Missing and 6 partials ⚠️
...oud/teleport/v2/config/TableConfigurationFile.java 16.66% 5 Missing ⚠️
...gle/cloud/teleport/v2/config/TableLevelConfig.java 0.00% 1 Missing ⚠️
...cloud/teleport/v2/dofn/CreateSpannerReadOpsFn.java 91.66% 0 Missing and 1 partial ⚠️
...ogle/cloud/teleport/v2/templates/GCSSpannerDV.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #4188       +/-   ##
=============================================
+ Coverage     35.85%   63.69%   +27.84%     
- Complexity      713     3011     +2298     
=============================================
  Files           250      576      +326     
  Lines         17151    33729    +16578     
  Branches       1755     3812     +2057     
=============================================
+ Hits           6149    21485    +15336     
- Misses        10487    11156      +669     
- Partials        515     1088      +573     
Components Coverage Δ
spanner-templates 84.45% <84.61%> (∅)
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 88.88% <ø> (∅)
spanner-live-reverse-replication 80.80% <ø> (∅)
spanner-bulk-migration 88.95% <ø> (∅)
gcs-spanner-dv 87.99% <84.61%> (∅)
Files with missing lines Coverage Δ
.../teleport/v2/transforms/SourceReaderTransform.java 100.00% <100.00%> (ø)
...teleport/v2/transforms/SpannerReaderTransform.java 100.00% <100.00%> (ø)
...gle/cloud/teleport/v2/config/TableLevelConfig.java 0.00% <0.00%> (ø)
...cloud/teleport/v2/dofn/CreateSpannerReadOpsFn.java 94.11% <91.66%> (ø)
...ogle/cloud/teleport/v2/templates/GCSSpannerDV.java 16.66% <0.00%> (ø)
...oud/teleport/v2/config/TableConfigurationFile.java 16.66% <16.66%> (ø)
...e/cloud/teleport/v2/config/TableConfiguration.java 87.23% <87.23%> (ø)

... and 454 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@manitgupta

Copy link
Copy Markdown
Member
tableListFilePath is flat text file
Very easy to make, maintain and edit for customers as it's just a list of tables. JSON for this would be overkill and would require formatters for no real advantage.

I don't think it should be flat text file, I think it should be a JSON. Reason - extensibility.
A TableConfiguration can have more aspects about a table such as which columns to include/exclude etc. and keeping a JSON (backed by a POJO in the code) will keep this configuration flexible and extendible.

@manitgupta manitgupta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at the full PR yet, lets align on the existing comments and then will look at the rest

@manitgupta

Copy link
Copy Markdown
Member

Can you put a sample tableConfiguration JSON in the description? I would like to have a look once

@aasthabharill
aasthabharill merged commit d5f1c05 into main Sep 13, 2026
31 of 32 checks passed
@aasthabharill
aasthabharill deleted the dv-table-config branch September 13, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition New feature or request size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants